#ifndef FORMCAMERA_H
#define FORMCAMERA_H

#include <QWidget>
#include "CameraCounter.h"


namespace Ui {
class FormCamera;
}

class FormCamera : public QWidget
{
    Q_OBJECT

public:
    static const size_t MAX_COUNT = 3;

public:
    explicit FormCamera(QWidget *parent = 0);
    ~FormCamera();

    void setCamera(Camera::DeviceList& deviceList);

    void start();

    void stop();

	void setRate(int fps);

    bool isStarted();

public slots:
    void onCountResult(int index, int count, int status, bool exception);

signals:
    void countResult(int index, int count, int status, bool exception);

protected:
    virtual void resizeEvent(QResizeEvent *event);

private:
    Ui::FormCamera *ui;


private:
    void setupUI();

    void resizeCarriage();

    void loadCarriageValueConfig();

    void showCountResult(int index, int count, int status, bool exception);

    QColor getStatusColor(int status);
	std::string getParamsPath();

private:
    Camera::DeviceList  m_deviceList;
	int	m_rate;

    typedef std::shared_ptr< CameraCounter >    CameraCounterPtr;
    typedef std::vector< CameraCounterPtr >     CameraCounterList;

    CameraCounterList   m_cameraCounters;

};

#endif // FORMCAMERA_H
